Name :Speed Command
Symbol :MC_MoveVelocity
Illustrate:
It is used to realize the speed control function of the shaft, and the rising edge is effective.
This command can only be invoked if the axis is enabled using the MC_Power command.
On the rising edge of EXECUTE, the input VEL, ACC, DIR values are locked, and the PLCOpen state machine of the axis switches to ContinuousMotion to start the speed control movement.
After the command is executed, it accelerates to the target velocity according to the given acceleration and direction (after reaching the INVELOCITY), and keeps running at a constant speed, at this time, even if EXECUTE becomes FALSE, the axis will continue to run, and if it needs to stop, it needs to call MC_Halt or MC_Stop.
This command can be interrupted and terminated: Instructions that can keep the axis in the ContinuousMotion, DiscreteMotion, and Stopping states can interrupt this command (the PLCOpen state machine of the reference axis), and when interrupted, CMDABORTED is valid.
When the axis runs in one direction and encounters the software limit, the command is interrupted and the execution is terminated (CMDABORTED is valid), and the axis stops moving but does not enter the Errorstop state. The MC_MoveVelocity command can be retriggered to move the axis in the opposite direction.
Image:
Parameter:
| The name of the parameter | data type | IN/OUT | Parameter role | Illustrate | Default value |
|---|---|---|---|---|---|
| AXISNO | UDINT | IN | Pulse shaft number | 0-7 | not |
| EXECUTE | BOOL | IN | Function block triggering | The rising edge triggers the execution of the order | FALSE |
| VEL | REAL | IN | Target speed | Target speed(non-0 value, absolute value is valid), ≤ maximum speed, in units:unit/s | not |
| ACC | REAL | IN | acceleration | acceleration(Non-0 values, absolute values are valid), ≤ maximum acceleration, in units:unit/s | not |
| DIR | USINT | IN | direction | 0:Forward Motion;1: Reverse Motion | not |
| INVELOCITY | BOOL | OUT | Speed arrival sign | TRUE:The target speed is reached | FALSE |
| BUSY | BOOL | OUT | Busy sign | TRUE:is in motion | FALSE |
| CMDABORTED | BOOL | OUT | End execution flag | TRUE:If it is interrupted by other instructions, the execution of this instruction will be terminated | FALSE |
| ERROR | BOOL | OUT | Error flags | TRUE:There was an error with the function block call | FALSE |
| ERRORID | UINT | OUT | Error codes | 0:Normal, Other: Error code value | 0 |
Example:
LD:
ST:
Interpretation:
AXISNO is 0, which means that the operating pulse axis is 0; EXECUTE is FALSE->TRUE, AND THE RISING EDGE TRIGGERS THE EXECUTION OF THE INSTRUCTION; VEL is 20, which means that the target speed is 20unit/s; ACC is 100, which means acceleration and deceleration at 100 unit/s until the target speed of 20 unit/s is reached; A DIR of 0 indicates a positive movement, and a DIR of 1 indicates a reverse movement; InVelOut is TRUE, indicating that the target speed has been reached; If BusyOut is TRUE, the speed command is being executed until the command is interrupted and the execution is terminated. If CmdAbortOut is TRUE, the execution has been terminated due to interruption. If ErrorOut is TURE, it means that there is an error and the command cannot be executed. If ErrorIdOut is 0, the execution is normal, and if it is not 0, there is an error and cannot be executed.